//
//  NSString+ZHWBase64.m
//  24-加密
//
//  Created by dllo on 16/8/16.
//  Copyright © 2016年 ZHW. All rights reserved.
//

#import "NSString+ZHWBase64.h"

@implementation NSString (ZHWBase64)
- (NSString *)stringWithBase64 {
    //
    NSData *stringData = [self dataUsingEncoding:NSUTF8StringEncoding];
    //
    NSString *base64String = [stringData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
    return base64String;
}

- (NSData *)base64StringWithData {
    return [[NSData alloc] initWithBase64EncodedString:self options:NSDataBase64DecodingIgnoreUnknownCharacters
            ];
}

- (NSString *)base64WithString {
    NSData *data = [[NSData alloc] initWithBase64EncodedString:self options:NSDataBase64DecodingIgnoreUnknownCharacters];
    NSString *orginString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    return orginString;
}
@end
